﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"
    CodeBehind="AddNewProduct.aspx.cs" Inherits="ProjectSem3.Admin.WebForm5" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript"> 
           function checkNumber1(sender, args) {
               var num = document.getElementById('<%=TextBoxPrice.ClientID %>').value;

            if (isNaN(num)) {
                args.IsValid = false;
            }
            else {

                args.IsValid = true;
            }
        }
        function checkNumber2(sender, args) {
            var num = document.getElementById('<%=TextBoxWarranty.ClientID %>').value;

            if (isNaN(num)) {
                args.IsValid = false;
            }
            else {

                args.IsValid = true;
            }
        }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentTabs" runat="server">
    <ul>
        <li><a href="ListProduct.aspx"><span>List</span></a></li>
        <li><a href="AddNewProduct.aspx" class="current"><span>New product</span></a></li>
    </ul>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="contentPage" runat="server">
    <div class="grid_9">
        <h1 class="dashboard">
            Product information
        </h1>
    </div>
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <div class="portlet">
        <div class="portlet-content nopadding">
            <table width="100%" cellpadding="0" cellspacing="0" id="box-table-a" summary="Employee Pay Sheet">
                <tr>
                    <th style="width: 25%">
                        SupplierID
                    </th>
                    <td style="width: 25%">
                        <asp:DropDownList ID="ddlSupplier" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td style="width: 50%">
                    </td>
                </tr>
                <tr>
                    <th>
                        CategoryID
                    </th>
                    <td>
                        <asp:DropDownList ID="ddlCategory" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <th>
                        Name
                    </th>
                    <td>
                        <asp:TextBox ID="TextBoxName" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBoxName"
                            Display="Dynamic" ErrorMessage="RequiredFieldValidator" ValidationGroup="1" ForeColor="Red">*</asp:RequiredFieldValidator>
                        <asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <th>
                        Price
                    </th>
                    <td>
                        <asp:TextBox ID="TextBoxPrice" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBoxPrice"
                            ErrorMessage="RequiredFieldValidator" Display="Dynamic" ForeColor="Red" ValidationGroup="1">*</asp:RequiredFieldValidator>
                        <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBoxPrice"
                            Display="Dynamic" ErrorMessage="CustomValidator" 
                            ClientValidationFunction="checkNumber1" ForeColor="Red" ValidationGroup="1">numberic only</asp:CustomValidator>
                        <asp:RangeValidator ID="RangeValidator1" runat="server" 
                            ControlToValidate="TextBoxPrice" Display="Dynamic" 
                            ErrorMessage="RangeValidator" ForeColor="Red" MinimumValue="0" 
                            ValidationGroup="1" MaximumValue="9999999999">9bil&gt;value&gt;0</asp:RangeValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        Warranty
                    </th>
                    <td>
                        <asp:TextBox ID="TextBoxWarranty" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBoxPrice"
                            ErrorMessage="RequiredFieldValidator" Display="Dynamic" ForeColor="Red" ValidationGroup="1">*</asp:RequiredFieldValidator>
                        <asp:CustomValidator ID="CustomValidator2" runat="server" ControlToValidate="TextBoxPrice"
                            Display="Dynamic" ErrorMessage="CustomValidator" 
                            ClientValidationFunction="checkNumber2" ForeColor="Red" ValidationGroup="1">numberic only</asp:CustomValidator>
                        <asp:RangeValidator ID="RangeValidator2" runat="server" 
                            ControlToValidate="TextBoxWarranty" Display="Dynamic" 
                            ErrorMessage="RangeValidator" ForeColor="Red" MinimumValue="0" 
                            ValidationGroup="1" MaximumValue="10">10&gt;value&gt;0</asp:RangeValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        Status
                    </th>
                    <td>
                        <div style="vertical-align: middle">
                            <input id="Radio1" type="radio" name="rdostatus" runat="server" />Enable
                            <input id="Radio2" type="radio" name="rdostatus" runat="server" checked="true" />Disable
                        </div>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <th>
                        DateUpdate
                    </th>
                    <td>
                        <asp:Label ID="lblDateupdate" runat="server" Text=""><%=DateTime.Now %></asp:Label>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <th>
                        Description
                    </th>
                    <td>
                        <textarea id="TextArea1Des" cols="20" name="S1" rows="2" runat="server"></textarea>
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBoxPrice"
                            ErrorMessage="RequiredFieldValidator" Display="Dynamic" ForeColor="Red" ValidationGroup="1">*</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        Image 1
                    </th>
                    <td>
                        <asp:FileUpload ID="fileImg1" runat="server" />
                    </td>
                    <td>
                        <asp:Label ID="lblFile1" runat="server" Text="" ForeColor="Red"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <th>
                        Image 2
                    </th>
                    <td>
                        <asp:FileUpload ID="fileImg2" runat="server" />
                    </td>
                    <td>
                        <asp:Label ID="lblFile2" runat="server" Text="" ForeColor="Red"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <th>
                        Image 3
                    </th>
                    <td>
                        <asp:FileUpload ID="fileImg3" runat="server" />
                    </td>
                    <td>
                        <asp:Label ID="lblFile3" runat="server" Text="" ForeColor="Red"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Add" ValidationGroup="1" />
                    </td>
                    <td>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</asp:Content>
